package com.kk.permission;

import android.content.Context;

import com.kk.permission.huawei.HuaweiPermissionGuideStrategy;
import com.kk.permission.huawei.al00.HuaweiAL00PermissionStrategy;
import com.kk.permission.huawei.bnd_al00.HuaweiBNDAL00PermissionGuideStrategy;
import com.kk.permission.huawei.bnd_al00_26.HuaweiBNDAL00SDK26PermissionGuideStrategy;
import com.kk.permission.huawei.d2_2010.HuaweiD22010PermissionGuideStrategy;
import com.kk.permission.huawei.kiw_al10.HuaweiKIWAL10PermissionGuideStrategy;
import com.kk.permission.utils.OSUtil;
import com.kk.permission.utils.PackageUtil;

public class PermissionGuideGenerator {
    public static IPermissionGuideStrategy generateGuideStratagy(Context context, boolean z) {
        IPermissionGuideStrategy miuiPermissionGuideStrategy = null;
            if (PackageUtil.isPackageInstalled("com.huawei.systemmanager")) {
                if (OSUtil.isHuaweiTAGAL00() || OSUtil.isHuaweiP7_L00_SDK22()) {
                    return new HuaweiAL00PermissionStrategy(context);
                }
                if (OSUtil.isHuaweiSDK24()) {
                    return new HuaweiBNDAL00PermissionGuideStrategy(context);
                }
                if (OSUtil.isHuaweiSDK26() || OSUtil.isHuaweiSDK27() || OSUtil.isHuaweiSDK28()) {
                    return new HuaweiBNDAL00SDK26PermissionGuideStrategy(context);
                }
                if (OSUtil.isHuaweiD2_2010() || OSUtil.isHuaweiChe1_CL20()) {
                    return new HuaweiD22010PermissionGuideStrategy(context);
                }
                if (OSUtil.isHuaweiKIW_AL10_SDK23() || OSUtil.isHuaweiPLK_AL10_SDK23() || OSUtil.isHuaweiSDK23()) {
                    return new HuaweiKIWAL10PermissionGuideStrategy(context);
                }
                return new HuaweiPermissionGuideStrategy(context);
        }
        return miuiPermissionGuideStrategy;
    }

    public static IPermissionGuideStrategy generateGuideStratagy(Context context) {
        return generateGuideStratagy(context, false);
    }

    public static boolean isSupportDevice(){
        if(!OSUtil.isHuawei())
            return false;

        if(OSUtil.isHuaweiTAGAL00() || OSUtil.isHuaweiP7_L00_SDK22() || OSUtil.isHuaweiSDK24() || OSUtil.isHuaweiSDK26() || OSUtil.isHuaweiSDK27() || OSUtil.isHuaweiSDK28()
                || OSUtil.isHuaweiD2_2010() || OSUtil.isHuaweiChe1_CL20() || OSUtil.isHuaweiKIW_AL10_SDK23() || OSUtil.isHuaweiPLK_AL10_SDK23() || OSUtil.isHuaweiSDK23())
            return true;

        return false;
    }
}
